#ifndef __GLRENDERER__
#define __GLRENDERER__

#include "..\RendererBase.h"
#include "..\PrimitiveRendererBase.h"

#include <cstdint>
#include <stack>

class GLRenderer : public RendererBase
{
	uint32_t _frameBuffer;
	Point4i _viewport;
	Matrix4f _modelView, _3dProjection, _2dProjection;
	const Matrix4f *_projection;
	std::stack<Matrix4f> _states;

public:
	inline const Point4i &GetViewport() { return _viewport; }
	inline const Matrix4f &GetProjectionMatrix() { return *_projection; }
	inline const Matrix4f &GetModelviewMatrix() { return _modelView; }

	GLRenderer() :
		_frameBuffer(0),
		_modelView(),
		_projection(&_3dProjection)
	{
	}

	void Translate(const float &x, const float &y, const float &z);
	void Scale(const float &x, const float &y, const float &z);
	void Rotate(const float &angle, const int &axisX, const int &axisY, const int &axisZ);
	void PopState();
	void PushState();
	void PrepareRender();
	void SetupMatrices(const int &width, const int &height);
	void Setup3DRender();
	void Setup2DRender();
	void SetCurrentBlockStatus(const bool &full, const bool &opaque);
	PrimitiveRendererBase *CreatePrimitiveRenderer();
	ITexture *CreateTexture();
};

#else
class GLRenderer;
#endif